package org.example.treehole.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.treehole.pojo.entity.Card;
import org.example.treehole.pojo.vo.CardVo;

import java.util.List;

@Mapper
public interface CardMapper {
    @Insert("INSERT INTO treehole.card (openid, content, post_time) VALUES (#{openid}, #{content}, #{postTime})")
    void insert(CardVo cardVo);

    @Select("SELECT * FROM treehole.card ORDER BY id DESC;")
    List<Card> selectAll();

    @Select("select count(*) from treehole.card")
    public long count();

    @Select("select * from treehole.card limit #{start},#{pageSize}")
    public List<Card> page(Integer start,Integer pageSize);
}
